﻿@using ISSMoviePlex.DAL.Models
@model IEnumerable<Movie>
@{
    ViewBag.Title = "Home Page";
}
<div id="sub-navigation">
    <div class="float-right">
        @using (Ajax.BeginForm("Index", "Home", new { genre = string.Empty },
                        new AjaxOptions { HttpMethod = "Post", UpdateTargetId = "movie" }))
                    {
            @Html.TextBox("search")
            <input type="submit" value="Search" />
                    }
    </div>
</div>

<div id="movie">
    <div id="content">        
            @for (int i = 0; i < Model.Count(); i++)
            {
                if ((i + 1) % 6 == 1)
                {
                    @:<div class="box">
                }
                Html.RenderPartial("MovieCard", Model.ElementAt(i), new ViewDataDictionary { { "index", i } });
                if ((i + 1) % 6 == 0)
                {
                    @:<div class="cl">&nbsp;</div>
                }
                if ((i + 1) % 6 == 0 || i == Model.Count() - 1)
                {
                    @:</div>
                }
            }

    </div>
    <div class="cl">&nbsp;</div>
</div>